package com.gill.touka.feign.fallback;
import java.util.Date;

import com.gill.touka.domain.dto.UserDTO;
import com.gill.touka.feign.client.UserCenterFeignClient;
import org.springframework.stereotype.Component;

/**
 * feign进行RPC失败后执行
 */
@Component
public class FeignFallback implements UserCenterFeignClient {

    /**
     * fallback方法的返回值和参数必须和原方法一样，所以采用实现feign client接口的方式来实现fallback类
     */
    @Override
    public UserDTO findById(Integer id) {
        UserDTO result = new UserDTO();
        result.setId(0);
        result.setWxId("feign调用远程服务失败信息");
        result.setWxNickname("feign调用远程服务失败信息");
        result.setRoles("feign调用远程服务失败信息");
        result.setAvatarUrl("feign调用远程服务失败信息");
        result.setCreateTime(new Date());
        result.setUpdateTime(new Date());
        result.setBonus(0);
        return result;
    }

    @Override
    public UserDTO testGet(UserDTO userDTO) {
        return null;
    }

    @Override
    public UserDTO testPost(UserDTO userDTO) {
        return null;
    }
}
